export default {
  reduceCartItem (state, id) {
    state.cart = state.cart.map(item => {
      if (item.id === id) {
        item.count--
      }
      return item
    })
  },
  addCartItem (state, id) {
    state.cart = state.cart.map(item => {
      if (item.id === id) {
        item.count++
      }
      return item
    })
  },
  exportid (state, idpack) {
    const {firstid1, secondid2} = idpack
    state.firstid = firstid1
    state.secondid = secondid2
  },
  loginSuccess (state, userInfo) {
    state.userInfo = {
      ...userInfo,
      isLogin: true
    }
  }
}
